package com.gdevelop.examples.demo.client;

import java.util.Date;

public class UserList extends SingleSelectionList<User>{
  private static final long MILIS_PER_DAY = 24*60*60*1000;
  static UserList createExampleData(){
    UserList users = new UserList();
    // Admin user
    User user = new User("admin", "Administrator", 
                      new Date(System.currentTimeMillis()-MILIS_PER_DAY*10000), 
                      "admin@example.com", 0, true);
    user.setUserId("admin");
    users.add(user);
    // Generate some user
    for (int i=0; i<20; i++){
      user = new User("user_" + i, "User " + i, 
                      new Date(System.currentTimeMillis()-MILIS_PER_DAY*((int)(10000*Math.random()))), 
                      "user" + i + "@example.com", 0, true);
      users.add(user);
    }
    
    return users;
  }

  public UserList() {
  }

  public User getSelected() {
    return super.getSelected();
  }
}
